//
//  ColorManager.m
//  JZShortVideo
//
//  Created by liujz on 2018/6/20.
//  Copyright © 2018 liujz. All rights reserved.
//

#import "ColorManager.h"

@implementation ColorManager

+ (UIColor *)colorWithRGB:(NSString *)rgbStr {
    NSMutableString *colorString = [NSMutableString stringWithString:rgbStr];
    [colorString replaceCharactersInRange:[rgbStr rangeOfString:@"#"] withString:@"0x"];
    long rgb = strtoul([colorString cStringUsingEncoding:NSUTF8StringEncoding], 0, 16);
    return [UIColor colorWithRed:((rgb & 0xFF0000) >> 16) / 255.0f
                           green:((rgb & 0xFF00) >> 8) / 255.0f
                            blue:(rgb & 0xFF) / 255.0f
                           alpha:1.0f];
}

@end
